﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional

namespace App_1.Migrations
{
    /// <inheritdoc />
    public partial class init : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "Player",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Account = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    AccountType = table.Column<string>(type: "nvarchar(10)", maxLength: 10, nullable: false),
                    DateCreated = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Player", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "Characters",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Nickname = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: false),
                    Classes = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: false),
                    Level = table.Column<int>(type: "int", nullable: false),
                    DateCreated = table.Column<DateTime>(type: "datetime2", nullable: false),
                    PlayerId = table.Column<Guid>(type: "uniqueidentifier", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Characters", x => x.Id);
                    table.ForeignKey(
                        name: "FK_Characters_Player_PlayerId",
                        column: x => x.PlayerId,
                        principalTable: "Player",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.InsertData(
                table: "Player",
                columns: new[] { "Id", "Account", "AccountType", "DateCreated" },
                values: new object[,]
                {
                    { new Guid("7c2dd686-35d6-4533-be00-827320120e66"), "mw2021", "Free", new DateTime(2024, 8, 15, 16, 3, 39, 899, DateTimeKind.Local).AddTicks(67) },
                    { new Guid("bdc0cfcd-61fa-41fa-9545-3ba3119f17fc"), "dc2021", "Free", new DateTime(2024, 8, 15, 16, 3, 39, 899, DateTimeKind.Local).AddTicks(78) }
                });

            migrationBuilder.InsertData(
                table: "Characters",
                columns: new[] { "Id", "Classes", "DateCreated", "Level", "Nickname", "PlayerId" },
                values: new object[,]
                {
                    { new Guid("26a4bb33-8d76-4a27-9c33-fde63cfb6ff2"), "Warrior", new DateTime(2024, 8, 15, 16, 3, 39, 899, DateTimeKind.Local).AddTicks(881), 90, "Iron Man", new Guid("7c2dd686-35d6-4533-be00-827320120e66") },
                    { new Guid("702c5fdd-081b-44ad-85a9-a4f21a4eb8f9"), "Mage", new DateTime(2024, 8, 15, 16, 3, 39, 899, DateTimeKind.Local).AddTicks(784), 99, "Code Man", new Guid("7c2dd686-35d6-4533-be00-827320120e66") },
                    { new Guid("7cc90968-5ace-4187-b1b2-83532e9f918c"), "Druid", new DateTime(2024, 8, 15, 16, 3, 39, 899, DateTimeKind.Local).AddTicks(883), 80, "Spider Man", new Guid("7c2dd686-35d6-4533-be00-827320120e66") },
                    { new Guid("a25bd499-32b7-4c7e-9cf8-73ada1878841"), "Death Knight", new DateTime(2024, 8, 15, 16, 3, 39, 899, DateTimeKind.Local).AddTicks(885), 90, "Batman", new Guid("bdc0cfcd-61fa-41fa-9545-3ba3119f17fc") },
                    { new Guid("a8fd5ca0-73bb-4fe4-9bb8-25c2e30ced78"), "Paladin", new DateTime(2024, 8, 15, 16, 3, 39, 899, DateTimeKind.Local).AddTicks(887), 99, "Superman", new Guid("bdc0cfcd-61fa-41fa-9545-3ba3119f17fc") }
                });

            migrationBuilder.CreateIndex(
                name: "IX_Characters_Nickname",
                table: "Characters",
                column: "Nickname",
                unique: true);

            migrationBuilder.CreateIndex(
                name: "IX_Characters_PlayerId",
                table: "Characters",
                column: "PlayerId");

            migrationBuilder.CreateIndex(
                name: "IX_Player_Account",
                table: "Player",
                column: "Account",
                unique: true);
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "Characters");

            migrationBuilder.DropTable(
                name: "Player");
        }
    }
}
